<?php include_once './header.php'; ?>
<? 
include('config.php'); 
echo "<table border=1 >"; 
echo "<tr>"; 
echo "<td><b>Id Descuento</b></td>"; 
echo "<td><b>Tipo Descuento</b></td>"; 
echo "<td><b>Curso</b></td>"; 
echo "<td><b>Ciudad</b></td>"; 
echo "<td><b>Descuento %</b></td>"; 
echo "</tr>"; 
$result = mysql_query("SELECT * ,(select nombreCurso from cursos cu where  d.curso_desc = cu.idCurso ) as curso, (select nombreCiudad from ciudades c where  d.ciudad_desc = c.idCiudad ) as ciudad FROM descuentos d") or trigger_error(mysql_error()); 
while($row = mysql_fetch_array($result)){ 
foreach($row AS $key => $value) { $row[$key] = stripslashes($value); } 
echo "<tr>";  
echo "<td valign='top'>" . nl2br( $row['id_descuento']) . "</td>";  
echo "<td valign='top'>" . nl2br( $row['tipo_descuento']) . "</td>";  
echo "<td valign='top'>" . nl2br( $row['curso']) . "</td>";  
echo "<td valign='top'>" . nl2br( $row['ciudad']) . "</td>";  
echo "<td valign='top'>" . nl2br( $row['por_desc']) . " % </td>";  
echo "<td valign='top'><a href=editDesc.php?id_descuento={$row['id_descuento']}>Edit</a></td><td><a href=deleteDesc.php?id_descuento={$row['id_descuento']}>Delete</a></td> "; 
echo "</tr>"; 
} 
echo "</table>"; 
echo "<a href=newDesc.php>New Row</a>"; 
?>


<?php include_once './footer.php'; ?>